/*
 * 角色管理 2010-01-15
 * author : tss
 * 
 */

//url 路径前缀
var startUrl = "/permission/role/";
var Role = {

	id : "Role",
	enterNewUrl : startUrl+"enterNew.html",
	enterEditUrl : startUrl+"enterEdit.html",
	enterViewUrl : startUrl+"enterView.html",
	saveUrl : startUrl + "save.html",
	updateUrl : startUrl + "update.html",
	removeUrl : startUrl + "delete.html",
	queryUrl : startUrl + "list.html",
	backQueryUrl : startUrl + "toList.html",
	chkIds : "chkIds",
	form : function(){
	  return document.forms[0];
    },

	// 校验
	validate : function() {
		/*try {
			return Validator.Validate(Role.form(), 3);
		} catch (e) {
			alert(e.message);
		}
		return false;*/
    	return true;
	},

	//首页
	desktop : function () {
	   
	  doSubmit(Role.form(),initVar.desktopUrl);
	},
	
	// 查询
	search : function search() {
		doSubmit(Role.form(), Role.queryUrl);
	},

	//进入新增
	enterNew : function() {

		var id = getSelectFirstId(Role.chkIds);
		doSubmit(Role.form(), Role.enterNewUrl+'?id='+id);
	},
	
	//进入修改
	enterEdit : function(id) {
		
		doSubmit(Role.form(), Role.enterEditUrl+'?id='+id);
	},

	// 进入详细
	enterView : function(id) {

		doSubmit(Role.form(), Role.enterViewUrl + "?id=" + id);
	},

	// 删除
	remove : function() {

		commonRemove(Role.form(), Role.removeUrl, Role.chkIds);
	},

	//保存
	save : function() {

		doSubmit(Role.form(), Role.saveUrl);
	},
	
	//修改
	update : function(id) {
		
		doSubmit(Role.form(), Role.updateUrl);
	},


	// 返回
	goBack : function() {

		doSubmit(Role.form(), Role.backQueryUrl);
	},
	
	//获得资源
	getMultiRes : function(){
		
		openMultiResWin();
	}
	
	
};

//加载
window.onload = function() {

	setTbStyle();
	execEvent(Role,"INPUT","button");
	execEvent(Role,"A");
	
//	if(Role.form().getAttribute("param").value == 'viewForm'){
//		//getMultiRes();
//	}
	
	
};
